package com.yztc.yidoutang.fragment.pic_fragment;

import com.yztc.yidoutang.bean.TuPianBean;

import java.util.HashMap;
import java.util.Map;

import rx.Subscriber;

/**
 * Created by My on 2016/10/18.
 */

public class PicPresenter implements PicContract.Presenter{
    private PicContract.Model model;
    private PicContract.View view;

    public PicPresenter(PicContract.View view) {
        this.view = view;
        this.model=new PicModel();
    }

    @Override
    public void getPicData(String queryWords) {
        Map<String,String> params=new HashMap<>();
        params.put("q",queryWords);
        params.put("last_match_id","0");
        model.getPicData(params, new Subscriber<TuPianBean>() {
            @Override
            public void onCompleted() {

            }

            @Override
            public void onError(Throwable e) {

            }

            @Override
            public void onNext(TuPianBean tuPianBean) {
                view.GetPicDataSuccess(tuPianBean);
            }
        });
    }
}
